
const pk = {
    state: {
        status: "matching", //matching playing
        socket: null,
        username: "",
        avatar: "",
        gamemap: "",
        a_id: "",
        a_sx: "",
        a_sy: "",
        b_id: "",
        b_sx: "",
        b_sy: "",
        gameObject: "",
        loser: "none",//all none A B
    },
    getters: {
    },
    mutations: {
        updateSocket(state, socket) {
            state.socket = socket;
        },
        updateOpponent(state, opponent) {
            state.username = opponent.username;
            state.avatar = opponent.avatar;
        },
        updateStatus(state, status) {
            state.status = status;
        },
        updateGamemap(state, gamemap) {
            state.gamemap = gamemap;
        },
        updateGame(state, game) {
            state.a_id = game.a_info.id;
            state.a_sx = game.a_info.sx;
            state.a_sy = game.a_info.sy;
            state.b_id = game.b_info.id;
            state.b_sx = game.b_info.sx;
            state.b_sy = game.b_info.sy;
        },
        updateGameM(state, game){
            state.a_id = game.a_id
            state.a_sx = game.a_sx
            state.a_sy = game.a_sy
            state.b_id = game.b_id
            state.b_sx = game.b_sx
            state.b_sy = game.b_sy
        },
        updateGameObject(state, gameObject) {
            state.gameObject = gameObject
        },
        updateLoser(state, loser) {
            state.loser = loser;
        }
    },
    actions: {
    },
    modules: {
    }
}

export default pk;
